
module.exports = async (ctx, next) => {
    const shortId = ""+ctx.params.shortId;
    const regex = new RegExp(shortId + "$");
    const tasks = await strapi.services.task.fetchAll({id:{$regex:regex }});
    console.log("tasks", tasks);
    if(!tasks[0]){
        return ctx.notFound();
    }else{
        ctx.params= {_id:tasks[0].id};
    }
    await next();
};
